package com.entity; 

import java.io.Serializable;
import java.util.Date;
import java.util.List;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.frame.common.ds.entity.SaasBaseEntity;
import com.frame.common.ds.annotation.Query;
import com.frame.common.ds.bean.PageDTO;
import com.frame.common.ds.enums.QueryType;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
 * @description ${classInfo.classComment}
 * @author ${authorName}
 * @date ${.now?string('yyyy-MM-dd')}
 */
@Data
@EqualsAndHashCode(callSuper=false)
public class ${classInfo.className}QueryDTO extends PageDTO<Object> implements Serializable {

    private static final long serialVersionUID = 1L;

<#if classInfo.fieldList?exists && classInfo.fieldList?size gt 0>
<#list classInfo.fieldList as fieldItem >
<#assign isDerived=fieldItem.fieldName?starts_with("createTime")||fieldItem.fieldName?starts_with("modifyTime")||fieldItem.fieldName?starts_with("createUser")||fieldItem.fieldName?starts_with("modifyUser")||fieldItem.fieldName?starts_with("reversion")/>
<#if !isDerived>
    <#if isComment?exists && isComment==true>/**
    * ${fieldItem.fieldComment}
    */</#if>	
    <#if fieldItem.fieldClass?starts_with("LocalDateTime") ||  fieldItem.fieldClass?starts_with("LocalDate")> 
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @Query(value = QueryType.GT,field = "${fieldItem.fieldName}")
    private LocalDate ${fieldItem.fieldName}Begin;
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @Query(value = QueryType.LT,field = "${fieldItem.fieldName}")
    private LocalDate ${fieldItem.fieldName}End;
    <#elseif fieldItem.fieldClass?ends_with("Date")>
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @Query(value = QueryType.GT,field = "${fieldItem.fieldName}")
    private LocalDate ${fieldItem.fieldName}Begin;
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @Query(value = QueryType.LT,field = "${fieldItem.fieldName}")
    private LocalDate ${fieldItem.fieldName}End;
    public LocalDateTime get${fieldItem.fieldName?cap_first}Begin() {
    	if(${fieldItem.fieldName}Begin == null)
    		return null;
        return LocalDateTime.of(${fieldItem.fieldName}Begin, LocalTime.MIN);
      }
      public LocalDateTime get${fieldItem.fieldName?cap_first}End() {
    	if(${fieldItem.fieldName}End == null)
    		return null;
        return LocalDateTime.of(${fieldItem.fieldName}End, LocalTime.MAX);
      }
    <#else>
    @Query(QueryType.EQ)
    private ${fieldItem.fieldClass} ${fieldItem.fieldName};
    </#if>
    </#if>
</#list>
</#if>
/**
 * 创建时间
 */
@DateTimeFormat(pattern = "yyyy-MM-dd")
@Query(value = QueryType.GT, field = "createTime")
private LocalDate createTimeBegin;
@DateTimeFormat(pattern = "yyyy-MM-dd")
@Query(value = QueryType.LT, field = "createTime")
private LocalDate createTimeEnd;

public LocalDateTime getCreateTimeBegin() {
  if(createTimeBegin == null)
    return null;
  return LocalDateTime.of(createTimeBegin, LocalTime.MIN);
}

public LocalDateTime getCreateTimeEnd() {
  if(createTimeEnd == null)
    return null;
  return LocalDateTime.of(createTimeEnd, LocalTime.MAX);
}

}
